﻿using WebApiClientCore;
using WebApiClientCore.Attributes;
using BPM.Web.Shared.Data;
using BPM.Web.Shared.Auth;

namespace BPM.Web.Shared.Service;

[TokenFilter]
public interface ITenantClient : IHttpApi
{
    /// <summary>
    /// 分页查询租户
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpGet("sysTenant/page")]
    ITask<XnRestfulResult<PageResult<TenantOutput>>> PageAsync(TenantPageInput body, CancellationToken token = default);

    /// <summary>
    /// 增加租户
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpPost("sysTenant/add")]
    ITask<XnRestfulResult<string>> AddAsync([JsonContent] AddTenantInput body, CancellationToken token = default);

    /// <summary>
    /// 新增租户时，初始化数据
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpPost("api/tenant/init-new-tenant")]
    ITask<XnRestfulResult<string>> InitNewTenantAsync([JsonContent] SysTenant body, CancellationToken token = default);

    /// <summary>
    /// 删除租户
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpPost("sysTenant/delete")]
    ITask<XnRestfulResult<string>> DeleteAsync([JsonContent] DeleteTenantInput body, CancellationToken token = default);

    /// <summary>
    /// 更新租户
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpPost("sysTenant/edit")]
    ITask<XnRestfulResult<string>> EditAsync([JsonContent] UpdateTenantInput body, CancellationToken token = default);

    /// <summary>
    /// 获取租户
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpGet("sysTenant/detail")]
    ITask<XnRestfulResult<SysTenant>> DetailAsync(QueryTenantInput body, CancellationToken token = default);

    /// <summary>
    /// 授权租户管理员角色菜单
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpPost("sysTenant/grantMenu")]
    ITask<XnRestfulResult<string>> GrantMenuAsync([JsonContent] GrantRoleMenuInput body, CancellationToken token = default);

    /// <summary>
    /// 获取租户管理员角色拥有菜单Id集合
    /// </summary>
    /// <param name="id"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpGet("sysTenant/ownMenu")]
    ITask<XnRestfulResult<List<long>>> OwnMenuAsync(QueryTenantInput body, CancellationToken token = default);

    /// <summary>
    /// 重置租户管理员密码
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpPost("sysTenant/resetPwd")]
    ITask<XnRestfulResult<string>> ResetPwdAsync([JsonContent] QueryTenantInput body, CancellationToken token = default);
}
